.class public Lcom/estrongs/android/pop/app/imageviewer/c;
.super Landroid/widget/BaseAdapter;
.source "ImageAdapter.java"


# instance fields
.field private a:Landroid/content/Context;

.field private b:Les/dm;

.field private c:I

.field private d:Landroid/graphics/drawable/Drawable;

.field private e:Landroid/graphics/Bitmap;

.field private f:I

.field private g:Landroid/util/LruCache;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Landroid/util/LruCache<",
            "Les/cm;",
            "Landroid/widget/ImageView;",
            ">;"
        }
    .end annotation
.end field

.field h:Lcom/estrongs/android/pop/app/imageviewer/d;

.field i:Lcom/estrongs/android/pop/app/imageviewer/b;

.field j:I


# direct methods
.method public constructor <init>(Landroid/content/Context;Les/dm;)V
    .locals 3

    .line 1
    invoke-direct {p0}, Landroid/widget/BaseAdapter;-><init>()V

    const/4 v0, 0x0

    .line 2
    iput v0, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->f:I

    .line 3
    new-instance v1, Landroid/util/LruCache;

    const/16 v2, 0x200

    invoke-direct {v1, v2}, Landroid/util/LruCache;-><init>(I)V

    iput-object v1, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->g:Landroid/util/LruCache;

    const/4 v1, 0x0

    .line 4
    iput-object v1, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->i:Lcom/estrongs/android/pop/app/imageviewer/b;

    const/16 v1, 0x64

    .line 5
    iput v1, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->j:I

    .line 6
    iput-object p1, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->a:Landroid/content/Context;

    .line 7
    iput-object p2, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->b:Les/dm;

    .line 8
    sget-object p2, Lcom/estrongs/android/pop/n;->Gallery:[I

    invoke-virtual {p1, p2}, Landroid/content/Context;->obtainStyledAttributes([I)Landroid/content/res/TypedArray;

    move-result-object p2

    .line 9
    invoke-virtual {p2, v0, v0}, Landroid/content/res/TypedArray;->getResourceId(II)I

    move-result v0

    iput v0, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->c:I

    .line 10
    invoke-virtual {p2}, Landroid/content/res/TypedArray;->recycle()V

    .line 11
    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object p2

    const v0, 0x7f0803da

    invoke-virtual {p2, v0}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;

    move-result-object p2

    iput-object p2, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->d:Landroid/graphics/drawable/Drawable;

    .line 12
    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object p1

    const p2, 0x7f0803db

    invoke-static {p1, p2}, Landroid/graphics/BitmapFactory;->decodeResource(Landroid/content/res/Resources;I)Landroid/graphics/Bitmap;

    move-result-object p1

    iput-object p1, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->e:Landroid/graphics/Bitmap;

    return-void
.end method

.method static synthetic a(Lcom/estrongs/android/pop/app/imageviewer/c;)I
    .locals 0

    .line 1
    iget p0, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->f:I

    return p0
.end method

.method private a(ILes/cm;Landroid/widget/ImageView;)V
    .locals 2

    .line 3
    iget-object p2, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->h:Lcom/estrongs/android/pop/app/imageviewer/d;

    iget-object v0, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->b:Les/dm;

    invoke-interface {v0, p1}, Les/dm;->b(I)Les/cm;

    move-result-object v0

    new-instance v1, Lcom/estrongs/android/pop/app/imageviewer/c$a;

    invoke-direct {v1, p0, p1, p3}, Lcom/estrongs/android/pop/app/imageviewer/c$a;-><init>(Lcom/estrongs/android/pop/app/imageviewer/c;ILandroid/widget/ImageView;)V

    invoke-virtual {p2, v0, v1, p1}, Lcom/estrongs/android/pop/app/imageviewer/d;->a(Les/cm;Lcom/estrongs/android/pop/app/imageviewer/d$b;I)V

    return-void
.end method

.method static synthetic b(Lcom/estrongs/android/pop/app/imageviewer/c;)Landroid/graphics/Bitmap;
    .locals 0

    .line 1
    iget-object p0, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->e:Landroid/graphics/Bitmap;

    return-object p0
.end method


# virtual methods
.method public a()V
    .locals 2

    .line 5
    iget-object v0, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->e:Landroid/graphics/Bitmap;

    const/4 v1, 0x0

    if-eqz v0, :cond_0

    invoke-virtual {v0}, Landroid/graphics/Bitmap;->isRecycled()Z

    move-result v0

    if-nez v0, :cond_0

    .line 6
    iget-object v0, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->e:Landroid/graphics/Bitmap;

    invoke-virtual {v0}, Landroid/graphics/Bitmap;->recycle()V

    .line 7
    iput-object v1, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->e:Landroid/graphics/Bitmap;

    .line 8
    :cond_0
    iget-object v0, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->g:Landroid/util/LruCache;

    if-eqz v0, :cond_1

    .line 9
    invoke-virtual {v0}, Landroid/util/LruCache;->evictAll()V

    .line 10
    :cond_1
    iget-object v0, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->h:Lcom/estrongs/android/pop/app/imageviewer/d;

    if-eqz v0, :cond_2

    .line 11
    invoke-virtual {v0}, Lcom/estrongs/android/pop/app/imageviewer/d;->a()[I

    .line 12
    iget-object v0, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->h:Lcom/estrongs/android/pop/app/imageviewer/d;

    invoke-virtual {v0}, Lcom/estrongs/android/pop/app/imageviewer/d;->b()V

    .line 13
    iput-object v1, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->h:Lcom/estrongs/android/pop/app/imageviewer/d;

    :cond_2
    return-void
.end method

.method public a(I)V
    .locals 0

    .line 2
    iput p1, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->f:I

    return-void
.end method

.method public a(II)V
    .locals 4

    .line 14
    iget-object v0, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->h:Lcom/estrongs/android/pop/app/imageviewer/d;

    if-nez v0, :cond_0

    .line 15
    new-instance v0, Lcom/estrongs/android/pop/app/imageviewer/d;

    invoke-direct {v0}, Lcom/estrongs/android/pop/app/imageviewer/d;-><init>()V

    iput-object v0, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->h:Lcom/estrongs/android/pop/app/imageviewer/d;

    :cond_0
    if-gez p1, :cond_1

    const/4 p1, 0x0

    .line 16
    :cond_1
    iget-object v0, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->b:Les/dm;

    invoke-interface {v0}, Les/dm;->getCount()I

    move-result v0

    if-le p2, v0, :cond_2

    .line 17
    iget-object p2, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->b:Les/dm;

    invoke-interface {p2}, Les/dm;->getCount()I

    move-result p2

    :cond_2
    :goto_0
    if-ge p1, p2, :cond_4

    .line 18
    iget-object v0, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->b:Les/dm;

    invoke-interface {v0, p1}, Les/dm;->b(I)Les/cm;

    move-result-object v0

    .line 19
    iget-object v1, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->g:Landroid/util/LruCache;

    invoke-virtual {v1, v0}, Landroid/util/LruCache;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Landroid/widget/ImageView;

    if-eqz v1, :cond_3

    .line 20
    invoke-virtual {v1}, Landroid/widget/ImageView;->getDrawable()Landroid/graphics/drawable/Drawable;

    move-result-object v2

    iget-object v3, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->d:Landroid/graphics/drawable/Drawable;

    if-ne v2, v3, :cond_3

    .line 21
    invoke-direct {p0, p1, v0, v1}, Lcom/estrongs/android/pop/app/imageviewer/c;->a(ILes/cm;Landroid/widget/ImageView;)V

    :cond_3
    add-int/lit8 p1, p1, 0x1

    goto :goto_0

    :cond_4
    return-void
.end method

.method public a(Lcom/estrongs/android/pop/app/imageviewer/b;)V
    .locals 0

    .line 4
    iput-object p1, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->i:Lcom/estrongs/android/pop/app/imageviewer/b;

    return-void
.end method

.method public b(I)V
    .locals 0

    .line 2
    iput p1, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->j:I

    return-void
.end method

.method public getCount()I
    .locals 1

    .line 1
    iget-object v0, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->b:Les/dm;

    invoke-interface {v0}, Les/dm;->getCount()I

    move-result v0

    return v0
.end method

.method public getItem(I)Ljava/lang/Object;
    .locals 1

    .line 1
    iget-object v0, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->b:Les/dm;

    invoke-interface {v0, p1}, Les/dm;->b(I)Les/cm;

    move-result-object p1

    return-object p1
.end method

.method public getItemId(I)J
    .locals 2

    int-to-long v0, p1

    return-wide v0
.end method

.method public getView(ILandroid/view/View;Landroid/view/ViewGroup;)Landroid/view/View;
    .locals 2

    .line 1
    iput p1, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->f:I

    .line 2
    iget-object p2, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->b:Les/dm;

    invoke-interface {p2, p1}, Les/dm;->b(I)Les/cm;

    move-result-object p1

    .line 3
    iget-object p2, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->g:Landroid/util/LruCache;

    invoke-virtual {p2, p1}, Landroid/util/LruCache;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object p2

    check-cast p2, Landroid/widget/ImageView;

    if-eqz p2, :cond_0

    .line 4
    invoke-virtual {p2}, Landroid/widget/ImageView;->getDrawable()Landroid/graphics/drawable/Drawable;

    move-result-object p3

    iget-object v0, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->d:Landroid/graphics/drawable/Drawable;

    if-eq p3, v0, :cond_0

    return-object p2

    .line 5
    :cond_0
    new-instance p2, Lcom/estrongs/android/pop/esclasses/ESImageView;

    iget-object p3, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->a:Landroid/content/Context;

    invoke-direct {p2, p3}, Lcom/estrongs/android/pop/esclasses/ESImageView;-><init>(Landroid/content/Context;)V

    const/4 p3, 0x1

    .line 6
    invoke-virtual {p2, p3}, Landroid/widget/ImageView;->setDrawingCacheEnabled(Z)V

    .line 7
    new-instance v0, Landroid/widget/Gallery$LayoutParams;

    iget v1, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->j:I

    invoke-direct {v0, v1, v1}, Landroid/widget/Gallery$LayoutParams;-><init>(II)V

    invoke-virtual {p2, v0}, Landroid/widget/ImageView;->setLayoutParams(Landroid/view/ViewGroup$LayoutParams;)V

    .line 8
    sget-object v0, Landroid/widget/ImageView$ScaleType;->FIT_CENTER:Landroid/widget/ImageView$ScaleType;

    invoke-virtual {p2, v0}, Landroid/widget/ImageView;->setScaleType(Landroid/widget/ImageView$ScaleType;)V

    .line 9
    :try_start_0
    iget v0, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->c:I

    invoke-virtual {p2, v0}, Landroid/widget/ImageView;->setBackgroundResource(I)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 10
    :catch_0
    iget-object v0, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->d:Landroid/graphics/drawable/Drawable;

    invoke-virtual {p2, v0}, Lcom/estrongs/android/pop/esclasses/ESImageView;->setImageDrawable(Landroid/graphics/drawable/Drawable;)V

    .line 11
    iget-object v0, p0, Lcom/estrongs/android/pop/app/imageviewer/c;->g:Landroid/util/LruCache;

    invoke-virtual {v0, p1, p2}, Landroid/util/LruCache;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 12
    invoke-virtual {p2, p3}, Landroid/widget/ImageView;->setFocusable(Z)V

    return-object p2
.end method
